#lang racket

(define (id x) x)

(define (inc x) (+ x 1))
  
(define (product term a next b)
  (define (iter a result)
    (if (> a b)
        result
        (iter (next a) (* result (term a)))))
  (iter a 1))

(define (factorial n) (product id 1 inc n))

(factorial 6)